package service

import (
	"fmt"
	"gitee.com/zhouli1369/go2struct/internal/dto"
)

// DbFactory 策略工厂
type DbFactory struct{}

func (f *DbFactory) CreateStrategy(param dto.CmdParam) (DbStrategy, error) {
	switch param.Driver {
	case "mysql":
		return &MysqlStrategy{Param: param}, nil
	case "postgre":
		return &PostgreStrategy{Param: param}, nil
	default:
		return nil, fmt.Errorf("driver %s not supported", param.Driver)
	}
}
